package com.yunti.springboot.controller;

import cn.hutool.core.util.StrUtil;
import com.yunti.springboot.annotation.Log;
import com.yunti.springboot.annotation.Permission;
import com.yunti.springboot.config.component.AbstractCurrentRequestComponent;
import com.yunti.springboot.service.SchoolService;
import com.yunti.springboot.vo.Result;
import com.yunti.springboot.vo.req.SchoolReq;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 用户角色关联表 前端控制器
 * </p>
 *
 * @author kmustleng
 * @since 2022-12-09
 */
@RestController

@RequestMapping("/school")
public class SchoolController {
@Resource
SchoolService service;

    @PostMapping("/getSchoolListPage")
    public Result getSchoolListPage(@RequestBody SchoolReq req){
        return service.getSchoolListPage(req);
    }

    @PostMapping("/getAllSchoolList")
    public Result getAllSchoolList(){
        return Result.success(service.list());
    }

    @Log
    @Permission({"superAdmin"})
    @PostMapping("/addSchool")
    public Result addSchool(@RequestBody SchoolReq req){
        return service.addSchool(req);
    }

    @Log
    @PostMapping("/editSchool")
    @Permission({"superAdmin"})
    public Result editSchool(@RequestBody SchoolReq req){
        return service.editSchool(req);
    }

    @Log
    @PostMapping("/delSchool")
    @Permission({"superAdmin"})
    public Result delSchool(@RequestBody SchoolReq req){
        return service.delSchool(req);
    }


}
